package com.itheima.App;

import com.itheima.Dao.BookDao;
import com.itheima.pojo.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AppLifeCyCLE {
    //生命周期
    public static void main(String[] args) {
        ClassPathXmlApplicationContext ca = new ClassPathXmlApplicationContext("applicationContext.xml");
        BookDao student =(BookDao)  ca.getBean("bookDao");

        student.save();
        //注册关闭钩子函数，在虚拟机退出之前回调次函数，关闭容器
        ca.registerShutdownHook();
        //关闭容器
        //ca.close();
    }
}
